home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / O4OPT.H < prev    next >
C/C++ Source or Header  |  1993-03-03  |  3KB  |  89 lines

  1. /* o4opt.h   (c)Copyright Sequiter Software Inc., 1990-1993.  All rights reserved. */
  2.  
  3. #define OPT4AVAIL -1
  4. #define OPT4NONE   0
  5. #define OPT4DBF    1
  6. #define OPT4INDEX  2
  7. #define OPT4OTHER  3
  8.  
  9. /* OPT4CHECK_RATE must be a minimum of 5 in order to optimize correctly */
  10. #define OPT4CHECK_RATE        10
  11.  
  12. #define OPT4GO_DBF_MODE        1
  13. #define OPT4SKIP_DBF_MODE      2
  14. #define OPT4SKIP_NDX_MODE      4
  15. #define OPT4SEEK_NDX_MODE      8
  16. #define OPT4APPEND_MODE       16
  17. #define OPT4WRITE_KEYS_MODE   32
  18. #define OPT4REINDEX_MODE      64
  19. #define OPT4START_MODE       128
  20.  
  21. /* factor of 2 that estimates the hash distribution, #slots = between #blocks * OPT4BLOCK_DENSITY and #blocks * OPT4BLOCK_DENSITY * 2 */
  22. #define OPT4BLOCK_DENSITY 2L
  23.  
  24. struct OPT4BLOCK_st ;
  25.  
  26. /* this structure must match OPT4BLOCK_st with opt4=file followed by pos=pos */
  27. typedef struct
  28. {
  29.    FILE4             *file ;
  30.    long              pos ;
  31. } OPT4CMP ;
  32.  
  33. typedef struct OPT4BLOCK_st
  34. {
  35.    LINK4             link ;
  36.    LINK4             lru_link ;
  37.    char              changed ;
  38.    unsigned          len ;
  39.  
  40.    /* these next 2 elements must match the OPT4CMP structure above */
  41.    FILE4             *file ;
  42.    long              pos ;
  43.  
  44.    void             *data ;
  45. } OPT4BLOCK ;
  46.  
  47. typedef struct
  48. {
  49.    LINK4            link ;
  50.    long             pos ;
  51. } STAT4OLD_CHAIN ;
  52.  
  53. typedef struct
  54. {
  55.    long             count ;
  56.    long             num_leafs ;
  57.    long             sequential_leafs ; /* good for determining if read-ahead skipping will be a good optimization technique for the given tag */
  58.    long             num_branches;
  59.    double           utilization ;    /* % free space in the file */
  60.    double           efficiency ;     /* ( # record entries * key_len ) / used space */
  61.    double           distribution ;   /* % of blocks that are branch blocks */
  62.    unsigned         max_height ;
  63.    unsigned         avg_height ;
  64.    unsigned         min_keys ;
  65.    unsigned         max_keys ;
  66.    unsigned         avg_keys ;
  67. } TAG4STATS ;
  68.  
  69. int    S4FUNCTION c4calc_type( unsigned long ) ;
  70.  
  71. void   S4FUNCTION d4update_prio( CODE4 S4PTR * ) ;
  72. void   S4FUNCTION file4set_write_opt( FILE4 S4PTR *, int ) ;
  73.  
  74. void   S4FUNCTION opt4block_clear( OPT4BLOCK * ) ;
  75. void   S4FUNCTION opt4block_remove( OPT4BLOCK S4PTR *, int ) ;
  76.  
  77. void   S4FUNCTION opt4file_delete( FILE4 S4PTR *, long, long ) ;
  78. LIST4 *S4FUNCTION opt4file_find_list( FILE4 S4PTR * ) ;
  79. int    S4FUNCTION opt4file_flush_list( FILE4 S4PTR *, LIST4 S4PTR *, int ) ;
  80. long   S4FUNCTION opt4file_hash( FILE4 S4PTR *, unsigned long ) ;
  81. void   S4FUNCTION opt4file_lru_top( FILE4 S4PTR *, LINK4 S4PTR *, char ) ;
  82. unsigned S4FUNCTION opt4file_read( FILE4 S4PTR *, long, void S4PTR *, unsigned ) ;
  83. OPT4BLOCK *S4FUNCTION opt4file_return_block( FILE4 S4PTR *, long, long ) ;
  84. int    S4FUNCTION opt4file_write( FILE4 S4PTR *, long, unsigned, void S4PTR *, char ) ;
  85.  
  86. int    S4FUNCTION opt4flush_all( OPT4 S4PTR *, char ) ;
  87. int    S4FUNCTION opt4flush_write_buffer( OPT4 S4PTR * ) ;
  88. void   S4FUNCTION opt4set_priority( OPT4 S4PTR *, char S4PTR * ) ;
  89.